#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int Fun(int num,int sum)
{
	if (num < 10)
	{
		return num;
	}
	else
	{
		sum = num % 10;
		num = num / 10;
		return sum + Fun(num, sum);
	}
}
int main()
{
	int sum = 0;
	int num = 0;
	int ret = 0;
	scanf("%d", &num);
	ret = Fun(num, sum);
	printf("%d", ret);
	return 0;
}